home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / tclX6.4c / dist / tclsrc / globrecur.tcl < prev    next >
Encoding:
Text File  |  1992-11-07  |  1.2 KB  |  33 lines

  1. #
  2. # globrecur.tcl --
  3. #
  4. #  Build up a directory list recursively.
  5. #------------------------------------------------------------------------------
  6. # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  7. #
  8. # Permission to use, copy, modify, and distribute this software and its
  9. # documentation for any purpose and without fee is hereby granted, provided
  10. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11. # Mark Diekhans make no representations about the suitability of this
  12. # software for any purpose.  It is provided "as is" without express or
  13. # implied warranty.
  14. #------------------------------------------------------------------------------
  15. # $Id: globrecur.tcl,v 2.0 1992/10/16 04:52:04 markd Rel $
  16. #------------------------------------------------------------------------------
  17. #
  18.  
  19. #@package: TclX-globrecur recursive_glob
  20.  
  21. proc recursive_glob {globlist} {
  22.     set result ""
  23.     foreach pattern $globlist {
  24.         foreach file [glob -nocomplain $pattern] {
  25.             lappend result $file
  26.             if [file isdirectory $file] {
  27.                 set result [concat $result [recursive_glob $file/*]]
  28.             }
  29.         }
  30.     }
  31.     return $result
  32. }
  33.